import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class TestDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        List<String> list1 = new ArrayList<>();


        //1、add
        list.add("lai");
        list.add("ming");
        list.add("zhong");
        System.out.println(list);

        list.add(0,"wo");
        list.add(1,"shi");
        System.out.println(list);

        list1.add("shuai");
        list.addAll(list1);
        System.out.println(list);
        System.out.println("==============================");

        //2、remove
        list.remove(5);
        System.out.println(list);
        list.add(2,"shi");
        System.out.println(list);
        list.remove(1);
        System.out.println(list);
        System.out.println("==============================");

        //3、get
        String ret = list.get(3);
        System.out.println(ret);
        System.out.println("==============================");

        //4、set
        String ret1 = list.set(0,"ni");
        System.out.println(ret1);
        System.out.println("==============================");

        //5、clear
        list1.clear();
        System.out.println(list1);
        System.out.println("==============================");

        //6、contain
        System.out.println(list.contains("zhong"));
        System.out.println(list.contains("wo"));
        System.out.println("==============================");

        //7、indexOf
        list.add(2,"zhong");
        System.out.println(list);
        System.out.println(list.indexOf("zhong"));
        System.out.println(list.lastIndexOf("zhong"));
        System.out.println("==============================");

        //8、subList
        List list3 = list.subList(1,5);
        System.out.println(list3);
    }
}
